<template lang="html">
  <div class="">
    <!--<el-row :gutter="10">-->
    <el-table
      :data="application"
      style="width: 100%"
      class="editDialog">
      <el-table-column
        prop="staffId"
        label="员工Id"
        align="center">
      </el-table-column>
      <el-table-column
        prop="staffName"
        label="姓名"
        sortable
        align="center">
      </el-table-column>
      <el-table-column
        prop="holidayStart"
        label="假期开始日期"
        sortable
        :formatter="formatDate1"
        align="center">
      </el-table-column>
      <el-table-column
        prop="holidayEnd"
        label="假期结束日期"
        sortable
        :formatter="formatDate2"
        align="center">
      </el-table-column>

    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="10"
      :page-size="100"
      layout="total, sizes, prev, pager, next, jumper"
      :total=application.length>
    </el-pagination>

  </div>
</template>

<script>
  export default {
    mounted: function () {
      this.$http.get('api/leavingsystem/application/', {headers:{"Authorization": "1000.123456.1"}}).then(response =>{
        // console.log("good");
        this.application=response.data.data;
        this.application= this.application.filter(ap => ap.status ==1 );
        console.log(this.application)
        // console.log(response.data.data.password);
        // console.log(this.ruleForm2.checkPass);
        // this.checkstaff.password="123456";
// console.log(response.json());
      }, response =>{
        // alert("wrong");
        console.log("wrong");
        // console.log(response.data);
        this.$alert('系统繁忙，请刷新重试', '加载失败', {
          confirmButtonText: '确定',
          // callback: action => {
          //   this.$message({
          //     type: 'info',
          //     message: `action: ${ action }`
          //   });
          // }
        });

      });
    },
    data() {
      return {
        application:[],
        //搜索用户姓名
        userName: '',
        //搜索日历下的数据
        userDate: [],
        //表格临时数据
        temp: [],
        //当前页数
        currentPage: 1,
      }
    },
    methods: {
      formatDate1(row){
        return this.$moment(row.holidayStart).format('YYYY-MM-DD HH:mm:ss');
      },
      formatDate2(row){
        return this.$moment(row.holidayEnd).format('YYYY-MM-DD HH:mm:ss');
      },
      //每页的数量发生改变时
      handleSizeChange(item) {
        console.log(item);
      },
      //跳转到某页
      handleCurrentChange(item) {
        console.log(item)
      },

    }
  }
</script>

<style lang="css">
  .editDialog {
    margin: 40px auto;
  }
</style>
